package com.codinghero.example.jdk.lock.waitnotify;

/**
 * print 0-1233, stop by wait function, <br/>
 * wait the notify function to wake up, then print 1235-9999
 * 
 * @author liutong
 * 
 */
public class PrintThread implements Runnable {

	public void run() {
		for (int i = 0; i < 1000; i++) {
			if (i == 123) {
				synchronized (WaitNotifyExample.SYNC) {
					try {
						System.out.println("wait");
						WaitNotifyExample.SYNC.wait();
					} catch (InterruptedException e) {
						e.printStackTrace();
					}
				}
			} else
				System.out.println(i);
		}
	}
}
